<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>迭代器</title>
    </head>
    <body>
        <script>
            //迭代器是一种接口，为不同的数据结构提供统一的访问机制，拥有iterator接口就可以遍历。
            //iterator供for of消费
            const arr = ["渊虹","鲨齿","天问"];
            // console.log(arr);
            // for (let i of arr){
            //     console.log(i);
            // }
            let iterator = arr[Symbol.iterator]();
            console.log(iterator);
            //调用对象的next()方法
                console.log(iterator.next());
                console.log(iterator.next());
                console.log(iterator.next());
                console.log(iterator.next());

        </script>
    </body>
</html>